Skip to content

cow: reconcile the accepted receipt uid against the local derivation - #589

Merged
mfw78 merged 1 commit into
dev/m1from
cow/559-uid-drift-assert
Jul 24, 2026
Merged

cow: reconcile the accepted receipt uid against the local derivation#589
mfw78 merged 1 commit into
dev/m1from
cow/559-uid-drift-assert

Conversation

@mfw78

@mfw78 mfw78 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

What

On the accepted submit path, submit_with now also computes assembly::order_uid(config.chain, &order, owner) and reconciles it against the UID the orderbook returned; a disagreement surfaces as VenueError::InvalidBody instead of being trusted as the receipt. The already-held arms carry a terse note that their UID is locally derived and unverified, since that reply carries no UID by design. A focused unit test covers the mismatch refusal; the existing accept tests already exercise the agreeing case.

Closes #559

Why

The already-held path derives its UID client-side, so any drift between the local derivation and the orderbook's assignment would silently split the two accept paths. Reconciling the accepted reply's UID turns such drift into a loud typed failure at the submit seam. This is the cheap option 3 from the issue; the extra GET round trip (option 1) and the widened status view (option 2) stay deferred.

Variant choice for maintainer review: the drift refusal reuses the existing VenueError::InvalidBody, as the closest invalid-body/internal-inconsistency shape; no WIT or venue-error variant was added.

Testing

nix develop --command just ci passed (fmt, clippy, doc, module wasms, workspace tests). nix develop --command just check-venue-agnostic passed. nix develop --command just check-cow-orderbook-only passed.

AI Assistance

Implemented with Claude Code.

An accepted submit reply's UID is now compared against assembly::order_uid over the submitted order; a disagreement returns VenueError::InvalidBody instead of trusting the mismatched receipt. The already-held path documents that its UID is locally derived and unverified, since that reply carries no UID by design.

Closes #559
@mfw78
mfw78 merged commit 5f3a302 into dev/m1 Jul 24, 2026
7 checks passed
@mfw78
mfw78 deleted the cow/559-uid-drift-assert branch July 24, 2026 23:02
mfw78 added a commit that referenced this pull request Jul 25, 2026
…mismatch (#597)

The venue-error WIT variant gains two additive, venue-neutral cases for the representable adapter-detected conditions that #589 and #590 had shoved into invalid-body strings: invalid-receipt for an empty or structurally-invalid receipt, and receipt-mismatch for a venue-returned identifier that disagrees with the locally derived one. Both are threaded through the bindgen VenueError, the owned VenueFault mirror and the faults.rs conversions, and the two adapter call sites move off invalid-body onto them so a caller can branch without parsing a message. invalid-body and denied stay as the escape hatch for custom or unrepresentable errors.

The change is a purely additive edit to videre:types with no version bump, kept extensible per the pre-cleave freeze policy, so it lands cheaply in the monorepo before the carve.

Closes #591
mfw78 added a commit that referenced this pull request Jul 27, 2026
…589)

An accepted submit reply's UID is now compared against assembly::order_uid over the submitted order; a disagreement returns VenueError::InvalidBody instead of trusting the mismatched receipt. The already-held path documents that its UID is locally derived and unverified, since that reply carries no UID by design.

Closes #559
mfw78 added a commit that referenced this pull request Jul 27, 2026
…mismatch (#597)

The venue-error WIT variant gains two additive, venue-neutral cases for the representable adapter-detected conditions that #589 and #590 had shoved into invalid-body strings: invalid-receipt for an empty or structurally-invalid receipt, and receipt-mismatch for a venue-returned identifier that disagrees with the locally derived one. Both are threaded through the bindgen VenueError, the owned VenueFault mirror and the faults.rs conversions, and the two adapter call sites move off invalid-body onto them so a caller can branch without parsing a message. invalid-body and denied stay as the escape hatch for custom or unrepresentable errors.

The change is a purely additive edit to videre:types with no version bump, kept extensible per the pre-cleave freeze policy, so it lands cheaply in the monorepo before the carve.

Closes #591
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant